package Logic.Objects;
import Logic.IPlayer;
import Logic.Square;
import Logic.Square.Type;

/**
 * A factory for boards,game engines and so on
 * 
 * it will be used for generic creations of instances
 * please try to use it, as it will be more convienet 
 * to replace or changes paramters only in one place
 *
 */
public class GameFactory {

	public static PlayEngine createEngine(int width, int height , int MaxNumOfPlayers)
	{
		PlayEngine engine = new PlayEngine();
		try {
			engine.setBoard(width,height);
			engine.setNumberOfPlayers(MaxNumOfPlayers);
		} catch (Exception e) {
			engine = null;
		}
		return engine;
	}

	public static IPlayer createPlayer(String name,Player.Type type,int playerNum)
	{
		return new Player(name,type,playerNum);
	}
	public static Square createSoldierSquare(int player,Square.Rank rank)
	{
		return new Square(player, rank);
	}
	public static Square createFreeSquare()
	{
		return new Square(Type.Free);
	}
	public static Square createWaterSquare()
	{
		return new Square(Type.Water);
	}
}
